package org.mokusakura.web.controller;

import org.mokusakura.constant.ServletUrlConstant;
import org.mokusakura.constant.SessionAttributeKeyConstant;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.SessionAttribute;

@RestController
public class VerifyController {
    @RequestMapping(value = ServletUrlConstant.VERIFY_SERVLET_URL)
    protected String verify(@RequestParam("verifyCode") String verifyCode,
                            @SessionAttribute(SessionAttributeKeyConstant.CORRECT_VERIFY_CODE) String correctVerifyCode) {

        if (verifyCode != null && verifyCode.equalsIgnoreCase(correctVerifyCode)) {
            return "true";
        } else {
            return "false";
        }
    }
}
